package mobileann.mafamily.utils;

import mobileann.mafamily.act.main.FS;
import mobileann.mafamily.entity.MemberInfoEntity;
import mobileann.mafamily.entity.UserInfoEntity;
import android.content.Context;
import com.mofind.android.utils.PreferenceUtils;

/**
 * Preferences操作函数类
 * 
 */
public class SPUtils {
	private final static String spfname = "MAFAS";

	public static final String UID = "uid";
	public static final String FID = "fid";
	public static final String ROLE = "role";
	public static final String RANDOM = "random";
	// new
	public static final String NICKNAME = "nickname";
	public static final String IS_PAGE_FIRST = "isPageFirst"; // 首次登录
	public static final String IS_REG_FIRST = "isRegFirst";
	public static final String LOGIN_STATE = "loginstate";

	public static final String BABY_LOCK_PASSWORD = "baby_lock_password";

	public synchronized static void setBabyLockPwd(String pwd) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				BABY_LOCK_PASSWORD, pwd);
	}

	public synchronized static String getBabyLockPwd() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(BABY_LOCK_PASSWORD, "123456");
	}

	public synchronized static void setLoginState(boolean state) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				LOGIN_STATE, state);
	}

	public synchronized static boolean getLoginState() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(LOGIN_STATE, false);
	}// 添加结束

	public synchronized static void clean(Context c) {
		// PreferenceUtils.clean(UID);
		// PreferenceUtils.clean(FID);
		// PreferenceUtils.clean(ROLE);
		// PreferenceUtils.clean(ISFIRST);
		// PreferenceUtils.clean(PASSWORD);
		// SPUtils.saveSelf(new UserInfoEntity());
		// SPUtils.savePagerIsFirst(true);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				IS_PAGE_FIRST, true);
		// SPUtils.setLoginState(false);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				LOGIN_STATE, false);
		// clearSelf();
		//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(UID,
		//		"0");
		//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(FID,
		//		"0");
		//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
		//		PASSWORD, "null");
		//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(ROLE,
		//		-1);
	}

	/**
	 * TODO doubleT4.13添加
	 */
	public static final String PASSWORD = "pass";

	public synchronized static void setPassWord(String str) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				PASSWORD, str);
	}

	public synchronized static String getPassWord() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(PASSWORD, "null");
	}// 添加结束

	public synchronized static String getNickName() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(NICKNAME, "我");
	}

	/**
	 * 保存我的信息
	 * 
	 * @param info
	 */
	public synchronized static void saveSelf(UserInfoEntity info) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(UID,
				info.getUid());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(FID,
				info.getFid());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(ROLE,
				info.getRole());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				NICKNAME, info.getNickname());
	}    

	public synchronized static String getUID() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(UID, "0");
	}

	public synchronized static String getFID() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(FID, "0");
	}

	public synchronized static int getRole() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				ROLE, -1);
	}

	public synchronized static String getRandomKey() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(RANDOM, "0");
	}

	/**
	 * 是否首次登录
	 * 
	 * @param isFirst
	 */
	public synchronized static void savePagerIsFirst(boolean isFirst) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				IS_PAGE_FIRST, isFirst);
	}

	public synchronized static boolean getPagerIsFirst() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(IS_PAGE_FIRST, true);
	}

	public synchronized static void saveRegIsFirst(boolean isFirst) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				IS_REG_FIRST, isFirst);
	}

	public synchronized static boolean getRegIsFirst() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(IS_REG_FIRST, true);
	}

	/**
	 * 记录防卸载标志位 doubleT
	 * 
	 * @param i
	 */
	public synchronized static void setUninstallLocked(boolean i) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"isUninstallLocked", i);

	}

	/**
	 * 获取防卸载标志位 doubleT
	 * 
	 * @return
	 */
	public synchronized static boolean getUninstallLocked() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("isUninstallLocked", false);
	}

	/**
	 * 设置手动锁屏标志位
	 * 
	 * @param i
	 */
	public synchronized static void setIsLockedByHand(boolean i) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"IsLockedByHand", i);
	}

	/**
	 * 获取手动锁屏标志位
	 * 
	 * @return
	 */
	public synchronized static boolean getIsLockedByHand() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("IsLockedByHand", false);
	}

	/**
	 * 设置锁屏标志位
	 * 
	 * @param i
	 */
	public synchronized static void setIsLockedState(boolean i) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"IsLockedState", i);
	}

	/**
	 * 获取锁屏标志位
	 * 
	 * @return
	 */
	public synchronized static boolean getIsLockedState() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("IsLockedState", false);
	}

	public synchronized static void setUninstallLocked(String uid,
			boolean isUninstall) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid, isUninstall);

	}

	public synchronized static boolean getUninstallLocked(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid, false);
	}

	/**
	 * 记录是否处于电子围栏内，有值代表处于电子围栏内
	 */
	public static final String ELENAME = "elename";

	public synchronized static String getELENAME() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(ELENAME, "");
	}

	public synchronized static void setELENAME(String aEleName) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				ELENAME, aEleName);
	}

	/**
	 * 记录当前锁屏的用户列表
	 */
	public static final String LOCKUSERLIST = "lockuserlist";

	public synchronized static boolean isLockUid(String aUID) {
		boolean bret = false;
		String strUids = PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(LOCKUSERLIST, "");
		if (strUids.length() > 0) {
			String[] uids = strUids.split(">");
			if (uids != null) {
				for (int i = 0; i < uids.length; i++) {
					if (uids[i].equals(aUID)) {
						bret = true;
						break;
					}
				}
			}
		}
		return bret;
	}

	public synchronized static void setLockUid(String aUID, boolean isLock) {
		String strUids = PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(LOCKUSERLIST, "");
		if (strUids.length() <= 0) {
			if (isLock) {
				PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.writeString(LOCKUSERLIST, aUID);
			}
		} else {
			if (isLock) {
				String[] uids = strUids.split(">");
				boolean bfound = false;
				if (uids != null) {
					for (int i = 0; i < uids.length; i++) {
						if (uids[i].equals(aUID)) {
							bfound = true;
							break;
						}
					}
				}
				if (!bfound) {
					strUids = strUids + ">" + aUID;
					PreferenceUtils.getInstance(FS.getInstance(), spfname)
					.writeString(LOCKUSERLIST, strUids);
				}
			} else {
				String[] uids = strUids.split(">");
				int ifound = -1;
				if (uids != null) {
					for (int i = 0; i < uids.length; i++) {
						if (uids[i].equals(aUID)) {
							ifound = i;
							break;
						}
					}
				}
				if (ifound >= 0) {
					strUids = "";
					for (int i = 0; i < uids.length; i++) {
						if (i != ifound) {
							strUids = strUids + uids[i] + ">";
						}
					}
					if (strUids.length() > 0) {
						strUids = strUids.substring(0, strUids.length() - 1);
					}
					PreferenceUtils.getInstance(FS.getInstance(), spfname)
					.writeString(LOCKUSERLIST, strUids);
				}
			}
		}
	}

	/**
	 * 留言板是否声音提示
	 */
	public static final String MSG_NOTIFY_VOICE = "MsgNotifyVoice";

	public synchronized static boolean getMsgNotifyVoice() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(MSG_NOTIFY_VOICE, true);
	}

	public synchronized static void setMsgNotifyVoice(boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				MSG_NOTIFY_VOICE, aValue);
	}

	/**
	 * 留言板是否震动提示
	 */
	public static final String MSG_NOTIFY_VERBERATE = "MsgNotifyVerberate";

	public synchronized static boolean getMsgNotifyVerberate() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(MSG_NOTIFY_VERBERATE, true);
	}

	public synchronized static void setMsgNotifyVerberate(boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				MSG_NOTIFY_VERBERATE, aValue);
	}

	/**
	 * 引导界面记录
	 */
	public synchronized static boolean getGuardShowen(String aGuardTag) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aGuardTag, false);
	}

	public synchronized static void setGuardShowen(String aGuardTag,
			boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aGuardTag, aValue);
	}

	/**
	 * 弹出使用方法记录
	 */
	public synchronized static boolean getUserGuideShowen(String aGuardTag) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aGuardTag, false);
	}

	public synchronized static void setUserGuideShowen(String aGuardTag,
			boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aGuardTag, aValue);
	}

	/**
	 * 自启动提示记录
	 */
	public synchronized static boolean getStartTips(String aGuardTag) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aGuardTag, false);
	}

	public synchronized static void setStartTips(String aGuardTag,
			boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aGuardTag, aValue);
	}

	/***
	 * 通过TAG来设定和获取String值
	 */
	public synchronized static String getTagStringValue(String aTag) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(aTag, "");
	}

	public synchronized static void setTagStringValue(String aTag, String aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				aTag, aValue);
	}

	/***
	 * 通过TAG来设定和获取boolean值
	 */
	public synchronized static boolean getTagBoolValue(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, false);
	}

	public synchronized static void setTagBoolValue(String aTag, boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	/***
	 * 设定WiFi下自动更新离线地图
	 */
	public synchronized static boolean getWifiAutoUpdate(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, false);
	}

	public synchronized static void setWifiAutoUpdate(String aTag,
			boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	/**
	 * 离线地图下载提示
	 */
	public synchronized static boolean getOfflineMapTips(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, true);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, true);
	}

	public synchronized static void setOfflineMapTips(String aTag,
			boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	/**
	 * 免责声明勾选记录
	 */
	public synchronized static boolean isDisclaimerChecked(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, false);
	}

	public synchronized static void setDisclaimer(String aTag, boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	/**
	 * 联网状态是否记录
	 */
	public synchronized static boolean isStatusRecord(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, false);
	}

	public synchronized static void setStatusRecord(String aTag, boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	/**
	 * 用户是否改变联网状态
	 */
	public synchronized static boolean isUserChanged(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, false);
	}

	public synchronized static void setUserChanged(String aTag, boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	public synchronized static int getNetStatus() {
		// return PreferenceUtils.readInt("NetStatus", 1);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				"NetStatus", 1);
	}

	public synchronized static void saveNetStatus(int status) {
		// PreferenceUtils.writeInt("NetStatus", status);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				"NetStatus", status);
	}

	/**
	 * miui提示的展示状态
	 */
	public synchronized static boolean isMIUItipsShow(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, false);
	}

	public synchronized static void setMIUItipsShow(String aTag, boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	/**
	 * Android L提示的展示状态
	 */
	public synchronized static boolean isAndroidLtipsShow(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, false);
	}

	public synchronized static void setAndroidLtipsShow(String aTag,
			boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	/**
	 * 记录当前使用的地图SDK
	 */
	public static final String MAPSDK = "mapsdk";

	public synchronized static String getMAPSDK() {
		// return PreferenceUtils.readString(MAPSDK, "BMap");
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(MAPSDK, "BMap");
	}

	public synchronized static void setMAPSDK(String aMapSdk) {
		// PreferenceUtils.writeString(MAPSDK, aMapSdk);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MAPSDK, aMapSdk);
	}

	public synchronized static void setisdoxiezai(String uid, Boolean i) {
		// PreferenceUtils.writeBoolean("isdoxiezai" + uid, i);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"isdoxiezai" + uid, i);
	}

	public synchronized static boolean getisdoxiezai(String uid) {
		// return PreferenceUtils.readBoolean("isdoxiezai" + uid, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("isdoxiezai" + uid, false);
	}

	/**
	 * 超时提示的展示状态
	 */
	public synchronized static boolean getWarningShow(String aTag) {
		// return PreferenceUtils.readBoolean(aTag, false);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(aTag, false);
	}

	public synchronized static void setWarningShow(String aTag, boolean aValue) {
		// PreferenceUtils.writeBoolean(aTag, aValue);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				aTag, aValue);
	}

	/**
	 * 是否开启超时提醒
	 */
	public static final String WARNING_SHOW = "WarningShow";

	public synchronized static boolean getIsWarningShow() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(WARNING_SHOW, true);
	}

	public synchronized static void setIsWarningShow(boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				WARNING_SHOW, aValue);
	}
	/**
	 * 是否启用跟屁虫锁屏
	 */
	public static final String LOCK_START = "LockStart";
	public static final String LOCK_SETTED = "LockSetted";

	public synchronized static boolean getLockStart() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(LOCK_START, false);
	}

	public synchronized static void setLockStart(boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				LOCK_START, aValue);
	}
	public synchronized static boolean getLockSetted() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(LOCK_SETTED, false);
	}
	public synchronized static void setLockSetted(boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				LOCK_SETTED, aValue);
	}
	public synchronized static boolean getLockSetItemClicked(String tag){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(tag, false);
	}
	public synchronized static void setLockSetItemClicked(String tag, boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				tag, value);
	}

	/**
	 * 是否进行第一次搜星
	 */
	public static final String GPS_RECORD = "recordGPS";

	public synchronized static boolean getGPSRecord() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(GPS_RECORD, false);
	}

	public synchronized static void setGPSRecord(boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				GPS_RECORD, aValue);
	}

	/**
	 * 第一次搜星是否成功
	 */
	public static final String GPS_FRIST_SUCCESS = "gpsFristSuccess";

	public synchronized static boolean getFristRecordSucceed() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(GPS_FRIST_SUCCESS, true);
	}

	public synchronized static void setFristRecordSucceed(boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				GPS_FRIST_SUCCESS, aValue);
	}

	/**
	 * gps是否正在工作
	 */
	public static final String GPS_WORK = "gpsWork";

	public synchronized static boolean getGPSWork() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(GPS_WORK, false);
	}

	public synchronized static void setGPSWork(boolean aValue) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				GPS_WORK, aValue);
	}

	/**
	 * 获取用户的UID
	 */
	private static final String UIDBYPHONENUM = "UidByPhoneNum";

	public synchronized static void setUidByPhoneNum(String uid) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				UIDBYPHONENUM, uid);
		;
	}

	public synchronized static String getUidByPhoneNum() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(UIDBYPHONENUM, "");
	}

	private static final String VersionChannel = "VersionChannel";

	public synchronized static void setVersionChannel(String channel) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				VersionChannel, channel);
	}

	public synchronized static String getVersionChannel() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(VersionChannel, "qijian");
	}

	private static final String VERSION = "Version";

	public synchronized static void setVersion(String version) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				VERSION, version);
	}

	public synchronized static String getVersion() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(VERSION, "2.0");
	}

	/**
	 * 记录RTC启动定位次数
	 */
	public static final String RTCCOUNT = "rtc_count";

	public synchronized static void setLocTypeCount(int count) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				RTCCOUNT, count);
	}

	public synchronized static int getLocTypeCount() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				RTCCOUNT, 0);
	}

	public synchronized static int getPageNum() {
		// return PreferenceUtils.readInt("NetStatus", 1);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				"PageNum", 0);
	}

	public synchronized static void savePageNum(int status) {
		// PreferenceUtils.writeInt("NetStatus", status);
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				"PageNum", status);
	}

	/**
	 * 登录获取信息
	 */
	//    public synchronized static void setUID2(String channel) {
	//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//		"UID2", channel);
	//    }
	//
	//    public synchronized static String getUID2() {
	//	return PreferenceUtils.getInstance(FS.getInstance(), spfname)
	//		.readString("UID2", "0");
	//    }
	//
	//    public synchronized static void setFID2(String channel) {
	//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//		"FID2", channel);
	//    }
	//
	//    public synchronized static String getFID2() {
	//	return PreferenceUtils.getInstance(FS.getInstance(), spfname)
	//		.readString("FID2", "0");
	//    }
	//
	//    public synchronized static void setIRAD(String channel) {
	//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//		"irad", channel);
	//    }
	//
	//    public synchronized static String getIRAD() {
	//	return PreferenceUtils.getInstance(FS.getInstance(), spfname)
	//		.readString("irad", "0");
	//    }
	//
	//    public synchronized static void setURAD(String channel) {
	//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//		"urad", channel);
	//    }
	//
	//    public synchronized static String getURAD() {
	//	return PreferenceUtils.getInstance(FS.getInstance(), spfname)
	//		.readString("urad", "0");
	//    }
	//
	//    public synchronized static void setFRAD(String channel) {
	//	PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//		"frad", channel);
	//    }
	//
	//    public synchronized static String getFRAD() {
	//	return PreferenceUtils.getInstance(FS.getInstance(), spfname)
	//		.readString("frad", "0");
	//    }

	/*
	 * // 是否是第一次修改昵称 public synchronized static void setIsFirstChangeName(String
	 * uid, boolean value) { PreferenceUtils.getInstance(FS.getInstance(),
	 * spfname).writeBoolean( uid + "IsFirstChangeName", value); }
	 * 
	 * public synchronized static boolean getIsFirstChangeName(String uid) {
	 * return PreferenceUtils.getInstance(FS.getInstance(), spfname)
	 * .readBoolean(uid + "IsFirstChangeName", true); }
	 * 
	 * // 是否是第一次修改头像 public synchronized static void setIsFirstChangeIcon(String
	 * uid, boolean value) { PreferenceUtils.getInstance(FS.getInstance(),
	 * spfname).writeBoolean( uid + "IsFirstChangeIcon", value); }
	 * 
	 * public synchronized static boolean getIsFirstChangeIcon(String uid) {
	 * return PreferenceUtils.getInstance(FS.getInstance(), spfname)
	 * .readBoolean(uid + "IsFirstChangeIcon", true); }
	 */
	// 是否是第一次锁屏
	public synchronized static void setIsFirstLock(String uid, boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsFirstLock", value);
	}

	public synchronized static boolean getIsFirstLock(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsFirstLock", true);
	}

	// 是否是第一次添加锁屏计划
	public synchronized static void setIsFirstAddLockplan(String uid,
			boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsFirstAddLockplan", value);
	}

	public synchronized static boolean getIsFirstAddLockplan(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsFirstAddLockplan", true);
	}

	/*
	 * // 是否是第一次添加电子围栏 public synchronized static void setIsFirstAddEle(String
	 * uid, boolean value) { PreferenceUtils.getInstance(FS.getInstance(),
	 * spfname).writeBoolean( uid + "IsFirstAddEle", value); }
	 * 
	 * public synchronized static boolean getIsFirstAddEle(String uid) { return
	 * PreferenceUtils.getInstance(FS.getInstance(), spfname) .readBoolean(uid +
	 * "IsFirstAddEle", true); }
	 */

	// 是否是第一次在QQ分享
	public synchronized static void setIsFirstQQShare(String uid, boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsFirstQQShare", value);
	}

	public synchronized static boolean getIsFirstQQShare(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsFirstQQShare", true);
	}

	// 是否是第一次在微信分享
	public synchronized static void setIsFirstMicroShare(String uid,
			boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsFirstMicroShare", value);
	}

	public synchronized static boolean getIsFirstMicroShare(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsFirstMicroShare", true);
	}

	// 是否是第一次在QQ空间分享
	public synchronized static void setIsFirstQZoneShare(String uid,
			boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsFirstQZoneShare", value);
	}

	public synchronized static boolean getIsFirstQZoneShare(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsFirstQZoneShare", true);
	}

	// 是否是第一次在微信朋友圈分享
	public synchronized static void setIsFirstFriendShare(String uid,
			boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsFirstFriendShare", value);
	}

	public synchronized static boolean getIsFirstFriendShare(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsFirstFriendShare", true);
	}

	// 是否是第一次在微博分享
	public synchronized static void setIsFirstWebShare(String uid, boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsFirstWebShare", value);
	}

	public synchronized static boolean getIsFirstWebShare(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsFirstWebShare", true);
	}

	// 是否在短信分享
	public synchronized static void setIsFirstSMSShare(String uid, boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsFirstSMSShare", value);
	}

	public synchronized static boolean getIsFirstSMSShare(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsFirstSMSShare", true);
	}

	// 是否是重启
	public synchronized static void setIsLaunch(String uid, boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsLaunch", value);
	}

	public synchronized static boolean getIsLaunch(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsLaunch", true);
	}
	// 是否是重启
	public synchronized static void setIsMyLaunch(String uid, boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "IsMyLaunch", value);
	}

	public synchronized static boolean getIsMyLaunch(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "IsMyLaunch", true);
	}

	// 记录启动次数
	public synchronized static void setLaunchTimes(String uid, int value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				uid + "LaunchTimes", value);
	}

	public synchronized static int getLaunchTimes(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				uid + "LaunchTimes", 0);
	}

	// 记录查看手机使用详情次数
	public synchronized static void setAppDetailTimes(String uid, int value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				uid + "AppDetailTimes", value);
	}

	public synchronized static int getAppDetailTimes(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				uid + "AppDetailTimes", 0);
	}

	// 记录查看位置次数
	public synchronized static void setLocationTimes(String uid, int value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				uid + "LocationTimes", value);
	}

	public synchronized static int getLocationTimes(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				uid + "LocationTimes", 0);
	}

	// 记录查看足迹次数
	public synchronized static void setTrackTimes(String uid, int value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				uid + "TrackTimes", value);
	}

	public synchronized static int getTrackTimes(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				uid + "TrackTimes", 0);
	}

	// 记录在聊天室聊天次数
	public synchronized static void setChatTimes(String uid, int value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				uid + "ChatTimes", value);
	}

	public synchronized static int getChatTimes(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
				uid + "ChatTimes", 0);
	}

	public synchronized static void setVersionChannel(String uid, String channel) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				uid + VersionChannel, channel);
	}

	public synchronized static String getVersionChannel(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(uid + VersionChannel, "aa");
	}

	// 当前日期
	public synchronized static void setCurDate(String uid, String date) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				uid + "curdate", date);
	}

	public synchronized static String getCurDate(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(uid + "curdate", "20150226");
	}

	// 是否登录完成
	public synchronized static void setLoginOK(boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"LoginOK", value);
	}

	public synchronized static boolean getLoginOK() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("LoginOK", false);
	}

	// 弹出领取勋章
	public synchronized static void setMedalPagePop(boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"MedalPagePop", value);
	}

	public synchronized static boolean getMedalPagePop() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("MedalPagePop", false);
	}

	// 是否保存数据
	public synchronized static void setDataKeepTag(boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"DataKeepTag", value);
	}

	public synchronized static boolean getDataKeepTag() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("DataKeepTag", false);
	}

	public synchronized static void cleanTask(String uid) {
		// PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
		// uid + "ChatTimes", 0);
		// PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
		// uid + "TrackTimes", 0);
		// PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
		// uid + "LocationTimes", 0);
		// PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
		// uid + "AppDetailTimes", 0);
		// PreferenceUtils.getInstance(FS.getInstance(), spfname).readInt(
		// uid + "LaunchTimes", 0);
		// PreferenceUtils.getInstance(FS.getInstance(), spfname).readBoolean(
		// uid + "IsLaunch", true);
		setChatTimes(uid, 0);
		setTrackTimes(uid, 0);
		setLocationTimes(uid, 0);
		setAppDetailTimes(uid, 0);
		setLaunchTimes(uid, 0);
		setIsLaunch(uid, true);
	}

	public synchronized static void setNewFileName(String name) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"FileName", name);
	}

	public synchronized static String getNewFileName() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("FileName", "");
	}

	// 弹出引导页
	public synchronized static void setGuideStep(boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"GuideStep", value);
	}

	public synchronized static boolean getGuideStep() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("GuideStep", true);
	}

	// 是否自动弹出抽奖界面
	public synchronized static void setMAAward(boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"MAAward", value);
	}

	public synchronized static boolean getMAAward() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("MAAward", true);
	}

	// new
	public static final String MYUID = "myuid";
	public static final String MYFID = "myfid";
	public static final String MYROLE = "myrole";
	public static final String MYNAME = "myname";
	public static final String MYURAD = "myurad";
	public static final String MYFRAD = "myfrad";
	public static final String MYIRAD = "myirad";
	public static final String MYLOCKPWD = "mylockpwd";
	public static final String MYPHONE = "myphone";
	public static final String MYAVATOR = "avatar";

	/**
	 * 保存我的信息
	 * 
	 * @param info
	 */
	public synchronized static void saveMySelf(MemberInfoEntity info) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYUID, info.getUid());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYFID, info.getFid());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYROLE, info.getRole());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYNAME, info.getName());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYURAD, info.getUrad());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYFRAD, info.getFrad());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYIRAD, info.getIrad());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYLOCKPWD, info.getLockpwd());
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYPHONE, info.getPhone());
		//增加将图片网址avator存入SharedPreference中  #ADRIAN.2015.7.16.10.12
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				MYAVATOR, info.getAvatar());
	}
	/**
	 * 清除我的信息
	 * 
	 * @param info
	 */
	//	public synchronized static void clearMySelf() {
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//				MYUID, "");
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//				MYFID, "0");
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//				MYNAME, "null");
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//				MYROLE, "-1");
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//				MYURAD, "0");
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//				MYFRAD, "0");
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//				MYIRAD, "0");
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
	//				MYLOCKPWD, "0");
	//	}


	public synchronized static String getMySelf(String tag) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(tag, "");
	}

	// 存验证码
	public synchronized static void setVerifyCode(String value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"VerifyCode", value);
	}

	public synchronized static String getVerifyCode() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("VerifyCode", "");
	}
	// 存登录的手机号
	public synchronized static void setNum(String value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"Num", value);
	}

	public synchronized static String getNum() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("Num", "");
	}

	// 是否点击下拉列表提示
	public synchronized static void setHasMemberClick(boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"HasMemberClick", value);
	}

	public synchronized static boolean getHasMemberClick() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("HasMemberClick", false);
	}
	// 定位界面是否点击下拉列表提示
	public synchronized static void setMapHasMemberClick(boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"MapHasMemberClick", value);
	}

	public synchronized static boolean getMapHasMemberClick() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("MapHasMemberClick", false);
	}
	// 是否是第一次启动
	public synchronized static void setIsFirstLaunch( boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				"IsFirstLaunch", value);
	}

	public synchronized static boolean getIsFirstLaunch() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("IsFirstLaunch", true);
	}

	//	public synchronized static void setMsgConut(String pkgName, int count){
	//		PreferenceUtils.getInstance(FS.getInstance(), spfname)
	//		.writeInt(pkgName, count);
	//	}
	//	
	//	public synchronized static int getMsgCount(String pkgName){
	//		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
	//				.readInt(pkgName, 0);
	//	}

	public synchronized static void setDeviceType(String uid,String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				uid+"DeviceType", value);
	}
	public synchronized static String getDeviceType(String uid){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(uid+"DeviceType", "0");
	}

	public synchronized static void setScreenHeight(int height){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeInt("LocViewHeight", height);
	}

	public synchronized static int getScreenHeight(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readInt("LocViewHeight", 600);
	}
	public synchronized static void setScreenWidth(int width){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeInt("LocViewWidth", width);
	}

	public synchronized static int getScreenWidth(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readInt("LocViewWidth", 480);
	}
	public synchronized static void setLoginType(String uid,String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				uid+"LoginType", value);
	}
	public synchronized static String getLoginType(String uid){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(uid+"LoginType", "");
	}

	public synchronized static void setRightSlide(){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("RightSlide", true);
	}

	public synchronized static boolean getRightSlide(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("RightSlide", false);
	}
	public synchronized static void setShareForCoins(){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("ShareForCoins", true);
	}

	public synchronized static boolean getShareForCoins(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("ShareForCoins", false);
	}
	//存储第三方登录获取的数据，用于添加成员时的重新获取登录数据
	public synchronized static void setRdLoginAccess(String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"RdLoginAccess", value);
	}
	public synchronized static String getRdLoginAccess(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("RdLoginAccess", "");
	}
	public synchronized static void setRdLoginRefresh(String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"RdLoginRefresh", value);
	}
	public synchronized static String getRdLoginRefresh(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("RdLoginRefresh", "");
	}
	public synchronized static void setRdLoginOpenId(String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"RdLoginOpenId", value);
	}
	public synchronized static String getRdLoginOpenId(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("RdLoginOpenId", "");
	}
	public synchronized static void setRdLoginExpires(String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"RdLoginExpires", value);
	}
	public synchronized static String getRdLoginExpires(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("RdLoginExpires", "");
	}
	/**
	 * 获取事件记录时间
	 * @return
	 */
	public synchronized static String getEventLogTime(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("EventLogTime", null);
	}
	/**
	 * 设置事件记录时间
	 * @param value
	 */
	public synchronized static void setEventLogTime(String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"EventLogTime", value);
	}
	//是否设置过记录时间
	public synchronized static boolean getEventLogTimeSetted(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("EventLogTimeSet", false);
	}

	public synchronized static void setEventLogTimeSetted(boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("EventLogTimeSet", value);
	}
	//是否开启GPS省电
	public synchronized static boolean getSavingMode(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("PowerSavingMode", true);
	}

	public synchronized static void setSavingMode(boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("PowerSavingMode", value);
	}

	//设置壁纸生成时间
	public synchronized static String getImageDate(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("ImageDate", null);
	}

	public synchronized static void setImageDate(String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"ImageDate", value);
	}
	//记录选择壁纸的位置
	public synchronized static int getWallPaperPosition(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readInt("WallPaperPosition", 0);
	}
	public synchronized static void setWallPaperPosition(int position){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				"WallPaperPosition", position);
	}
	//存放推荐码
	public synchronized static String getRefereeCode(String uid){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(uid+"RefereeCode", "");
	}

	public synchronized static void setRefereeCode(String uid,String value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				uid+"RefereeCode", value);
	}
	//分享领取金币
	public synchronized static int getShareCoin(String uid){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readInt(uid+"ShareCoin", 0);
	}

	public synchronized static void setShareCoin(String uid,int value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				uid+"ShareCoin", value);
	}
	//记录壁纸保存类型
	public synchronized static int getWallPaperType(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readInt("WallPaperType", WallPaperUtils.TYPE_ID);
	}
	public synchronized static void setWallPaperType(int type){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeInt(
				"WallPaperType", type);
	}
	//记录壁纸路径
	public synchronized static String getWallPaperPath(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("WallPaperPath", null);
	}
	public synchronized static void setWallPaperPath(String path){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"WallPaperPath", path);
	}
	// 是否要调整屏幕亮度
	public synchronized static void setScrrenLight(String uid, boolean value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeBoolean(
				uid + "ScrrenLight", value);
	}

	public synchronized static boolean getScrrenLight(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(uid + "ScrrenLight", true);
	}
	// 存放锁屏时间
	public synchronized static void setLockTime(String uid, String value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				uid + "LockTime", value);
	}

	public synchronized static String getLockTime(String uid) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(uid + "LockTime",900+"");
	}

	/**@deprecated 存放正在使用的软件 */
	public synchronized static void setTopApp(String value) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeString(
				"TopApp", value);
	}

	/**@deprecated 获取到当前正在使用的应用 */
	public synchronized static String getTopApp() {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString( "TopApp","");
	}
	/**@deprecated  存放正在使用的软件的开启时间	 */
	public synchronized static void setIsUsingApp(String pkgName,long starttime) {
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeLong(
				"IsUsingApp"+pkgName, starttime);
	}
	public synchronized static long getIsUsingApp(String pkgName) {
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readLong("IsUsingApp"+pkgName,0);
	}
	//判断某一锁屏计划是否被手动关闭,唯一标识(planid week time)
	public synchronized static boolean isWeekPlanClose(String planid,String week,String starttime,String endtime){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean(planid+week+starttime+endtime, true);
	}

	public synchronized static void setWeekPlanClose(String planid,String week,String starttime,String endtime,boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean(planid+week+starttime+endtime, value);
	}
	//记录是否正在上传数据
	public synchronized static boolean getIsToServer(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("IsToServer", false);
	}

	/**
	 * 设置是否正在上传数据<br>
	 * 主要应用
	 * <li>1.上传数据就将此标志位置true </li>
	 * <li>2.开机自启动的时候设置成false </li>
	 * <li>3.刚启动应用的设置成fals </li>
	 * <li>4.上传完应用详情数据,将此位置成true </li>
	 */
	public synchronized static void setIsToServer(boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.writeBoolean("IsToServer", value);
	}

	/**
	 * 主要功能:
	 * <br>在xml文件存储aUID的imgUrl的名字，*是经过MD5加密的*不加密了（此处key值:"img_"+aUID）
	 * @author ADRIAN
	 */
	public synchronized static void setMD5ImgUrl(String aUID, String imgPath){
		//		String kaUID = "img_" + aUID;
		StringBuilder sbSet = new StringBuilder(32);
		sbSet.append("img_");
		sbSet.append(aUID);
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeString(sbSet.toString(), imgPath);
	}

	/**
	 * 主要功能：
	 * <br>从xml中取得aUID的imgUrl的图片的名字（此处key值："img_"+aUID）
	 * @author ADRIAN
	 */
	public synchronized static String getMD5ImgUrl(String aUID){
		//		String kaUID = "img_" + aUID;
		StringBuilder sbGet = new StringBuilder(64);
		sbGet.append("img_"); sbGet.append(aUID);
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString(sbGet.toString(), "null");
	}
	//存放桌面包名获取的时间
	public synchronized static long getDeskAppDate(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readLong("DeskAppDate", 123456789);
	}

	public synchronized static void setDeskAppDate(long value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname).writeLong(
				"DeskAppDate", value);
	}

	/**
	 * 将最后一次的应用的包名记录在本地
	 * 专门为Android5.0详情问题
	 * @author ADRIAN.2015.7.23.14.40
	 */
	public synchronized static void setLastPackageName(String lastPackageName){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeString("lastPackageName", lastPackageName);
	}

	/**
	 * 取得最后一次的应用的包名
	 * 转么为Android5.0问题
	 *@author ADRIAN.2015.7.23.14.40
	 */
	public synchronized static String getLastPackageName(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("lastPackageName", "");
	}
	//是否在视力保护锁屏阶段
	public synchronized static boolean getLockPhoneState(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("LockPhoneState", false);
	}

	public synchronized static void setLockPhoneState(boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("LockPhoneState", value);
	}
	//判断锁屏周计划是锁的哪一个时段
	public synchronized static String getWeekPlanTime(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readString("WeekPlanTime","0");
	}

	public synchronized static void setWeekPlanTime(String planid,String week,String starttime,String endtime){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeString("WeekPlanTime",planid+week+starttime+endtime);
	}
	//周计划中要不要弹出没有权限提示
	public synchronized static boolean getCanShowAuthTips(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("CanShowAuthTips",false);
	}

	public synchronized static void setCanShowAuthTips(boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("CanShowAuthTips",value);
	}
	public synchronized static boolean getIsStopTime(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("IsStopTime",false);
	}

	public synchronized static void setIsStopTime(boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("IsStopTime",value);
	}

	public synchronized static int getLocStatusCount(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readInt("LocStatusCount", 0);
	}

	public synchronized static void setLocStatusCount(int value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeInt("LocStatusCount", value);
	}
	//判断是否是语音验证码
	public synchronized static boolean getIsVoiceCode(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("IsVoiceCode",false);
	}

	public synchronized static void setIsVoiceCode(boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("IsVoiceCode",value);
	}
	//判断是否显示广告
	public synchronized static boolean getIsShowAD(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readBoolean("IsShowAD",false);
	}

	/** 设置是否显示广告 */
	public synchronized static void setIsShowAD(boolean value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeBoolean("IsShowAD",value);
	}

	public synchronized static int getOfflineMapCheck(){
		return PreferenceUtils.getInstance(FS.getInstance(), spfname)
				.readInt("OfflineMapCheck", 0);
	}

	public synchronized static void setOfflineMapCheck(int value){
		PreferenceUtils.getInstance(FS.getInstance(), spfname)
		.writeInt("OfflineMapCheck", value);
	}
}
